Skip to content

feat: ability to init ts files with WerfRenderContext type#593

Merged
dmmordvi merged 3 commits intomainfrom
feat/init-ts-with-werf-types
Apr 13, 2026
Merged

feat: ability to init ts files with WerfRenderContext type#593
dmmordvi merged 3 commits intomainfrom
feat/init-ts-with-werf-types

Conversation

@dmmordvi
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi dmmordvi requested a review from ilya-lesikov April 10, 2026 17:30
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
pkg/ts/init.go Outdated

const denoBuildScript = "deno bundle --output=dist/bundle.js src/index.ts"
const (
defaultRenderContextType = "RenderContext"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it where WerfRenderContextType is defined and name it something like TSGenericRenderContextType and TSWerfRenderContextType. Then add a TSDefaultRenderContextType = TSGenericRenderContextType

}
`
deploymentTSContent = `import type { RenderContext } from '@nelm/chart-ts-sdk';
deploymentTSTmpl = `import type { {{RenderContextType}} } from '@nelm/chart-ts-sdk';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, since we started templating it, then let's do it properly via go text/template engine. Just init a new blank engine and pass a context ($) into it with all you need. Will be easier to extend later. And the template will become this instead: {{ $.RenderContextType }}

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi dmmordvi merged commit 4b90254 into main Apr 13, 2026
8 checks passed
@dmmordvi dmmordvi deleted the feat/init-ts-with-werf-types branch April 13, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants